Actions After Add, Edit, Save

Save Table and Add New Row in One Click

Description
This customization shows how to make the "Add" button in the Edit Record Page save the table before adding a new record row. It adds a row to the table in the last page.
Variables
Table Control Class
Select the editable table control where Add button is present
Add Button
Select Add button in the editable table control
Applies to
TableControl class
Code
 
''' 
''' Override the ${Add Button}_Click and add a new record row.
''' 
Public Overrides Sub ${Add Button}_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs)
    Try
        DbUtils.StartTransaction()
        
        ' First, save the data on the editable table.
        Me.SaveData()        
        Me.Page.CommitTransaction(sender)
        
        ' Add a new empty row to the editable table.            
        Me.AddNewRecord = 1        
    Catch ex As Exception

        ' Report error message to the user
        Utils.MiscUtils.RegisterJScriptAlert(Me, "UNIQUE_SCRIPTKEY", ex.Message)
        Me.Page.RollBackTransaction(sender)
    Finally
        DbUtils.EndTransaction()
    End Try
End Sub

     

Terms of Service Privacy Statement